package al.xc.common.define;

public class ComparablePair<T extends Comparable, V extends Comparable> implements Comparable {
    public ComparablePair() {}

    public ComparablePair(T left, V right) {
        this.left = left;
        this.right = right;
    }

    public T left;
    public V right;

    @Override
    public int compareTo(Object o) {
        if (!(o instanceof ComparablePair)) {
            throw new ClassCastException("不能转换为ComparablePair类型的对象");
        }
        ComparablePair info = (ComparablePair)o;
        int vl = this.left.compareTo(info.left);
        if (0 != vl) {
            return vl;
        }
        return this.right.compareTo(info.right);
    }
}
